package robot;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import lejos.nxt.comm.BTConnection;
import lejos.nxt.comm.Bluetooth;

public class Communication {

	private BTConnection conn;
	
	public Communication() {
		conn = Bluetooth.waitForConnection();
	}
	
	public int receiveInt() throws IOException {
		
		DataInputStream dis = conn.openDataInputStream();
		return dis.readInt();
	}
	
	public void sendInt(int arg) throws IOException {
		DataOutputStream dos = conn.openDataOutputStream();
		dos.writeInt(arg);
	}
	
}
